<?php

namespace Common\Model;

use Think\Model;

class LeavelModel extends Model {
    public static function newSelf()
    {
        return new self();
    }
    public function findOneById($id)
    {
        $res=$this->where(['id'=>$id])->find();
        $res['ratio']=LeavelRatioModel::newSelf()->getByLeavelId($res['id']);
        return $res;
    }
    
	public function getInfo()
	{
	    $info=$this->where(['status'=>'1'])->select();
	    foreach ($info as $k=>$v)
	    {
	        $infos[$v['id']]=$v;
	        $infos[$v['id']]['ratio']=LeavelRatioModel::newSelf()->getByLeavelId($v['id']);
	    }
	    return $infos;
	}
}